#pragma onec
#include <sys/types.h>
#include <sys/stat.h>
#include <iostream>
#include <unistd.h>
#include <fcntl.h>
#include <cerrno>
#include <cstring>
#include <cstdlib>
#include <string>
using namespace std;

#define FIFO_FILE "./myfifo"
#define MODE 0664

enum{
    FIFO_CREATE_ERR = 1,
    FIFO_DELETE_ERR,
    OPEN_FIFO_ERR
};


class Fifo
{
public:
    Fifo()
    {
        int ret = mkfifo(FIFO_FILE,MODE);
        if(ret == -1)
        {
            perror("mkfifo");
            exit(FIFO_CREATE_ERR);
        }
    }

    ~Fifo()
    {
        int n = unlink(FIFO_FILE);
        if(n == -1)
        {
            perror("unlink");
            exit(FIFO_DELETE_ERR);
        }

    }

};